// @ts-ignore
/* eslint-disable */
import { request } from "@/utils/request";

/** 忘记密码 发送密码重置邮件 POST /api/v1/auth/forgot-password */
export async function apiV1AuthForgotPassword(
  body: API.ForgotPasswordRequest,
  options?: { [key: string]: any }
) {
  return request<any>(`/api/v1/auth/forgot-password`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 用户登录 用户账号登录 POST /api/v1/auth/login */
export async function apiV1AuthLogin(
  body: API.LoginRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.TokenResponse }>(
    `/api/v1/auth/login`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}

/** 用户登出 用户账号登出 POST /api/v1/auth/logout */
export async function apiV1AuthLogout(options?: { [key: string]: any }) {
  return request<any>(`/api/v1/auth/logout`, {
    method: "POST",
    ...(options || {}),
  });
}

/** 刷新访问令牌 使用刷新令牌获取新的访问令牌 POST /api/v1/auth/refresh */
export async function apiV1AuthRefresh(
  body: API.RefreshTokenRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.TokenResponse }>(
    `/api/v1/auth/refresh`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}

/** 用户注册 注册新用户账号 POST /api/v1/auth/register */
export async function apiV1AuthRegister(
  body: API.RegisterRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.TokenResponse }>(
    `/api/v1/auth/register`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}

/** 重置密码 使用重置令牌重置密码 POST /api/v1/auth/reset-password */
export async function apiV1AuthResetPassword(
  body: API.ResetPasswordRequest,
  options?: { [key: string]: any }
) {
  return request<any>(`/api/v1/auth/reset-password`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 修改密码 修改当前登录用户的密码 PUT /api/v1/user/change-password */
export async function apiV1UserChangePassword(
  body: API.ChangePasswordRequest,
  options?: { [key: string]: any }
) {
  return request<any>(`/api/v1/user/change-password`, {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取用户资料 获取当前登录用户的个人资料 GET /api/v1/user/profile */
export async function apiV1UserProfile(options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.User }>(`/api/v1/user/profile`, {
    method: "GET",
    ...(options || {}),
  });
}

/** 更新用户资料 更新当前登录用户的个人资料 PUT /api/v1/user/profile */
export async function apiV1UserProfile2(
  body: API.UpdateProfileRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.User }>(`/api/v1/user/profile`, {
    method: "PUT",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}
